package com.example.design.proxyDemo.cglibProxy;

import java.lang.reflect.Method;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

public class CglibMethodInterceptor implements MethodInterceptor {

  @Override
  public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy)
      throws Throwable {
    System.out.println("开始执行");
    methodProxy.invokeSuper(o, objects);//代理的方法调用被代理的父类方法
    System.out.println("结束执行");
    return null;
  }
}
